require "Dialogs"
require "Frisk Character"
FriskDirection = "D"
AlowFriskMovement(false, false)
Arena.Resize(565, 130)
Player.sprite.alpha = 0
Encounter.Call("PapyrusAlpha", 1)

if #Encounter["Items"] <= 1 and (Encounter["Items"][1] == "[starcolor:7d7d7d][color:7d7d7d]Nothing[color:ffffff]" or Encounter["Items"][1] == "[starcolor:7d7d7d][color:7d7d7d]Nada[color:ffffff]") then
	Encounter["Items"] = {}
end

timezone = string.gsub(package.loaded.os.date("%Z"), ":00", "")
timezone = string.gsub(timezone, ":30", "")
hour = tonumber(package.loaded.os.date("%H")) + tonumber(timezone)
while hour >= 24 do
	hour = hour - 24
end
while hour < 0 do
	hour = hour + 24
end
day = tonumber(package.loaded.os.date("%d"))
month = tonumber(package.loaded.os.date("%m"))

if not Encounter["StartCounting"] then
	Encounter["tiempo"] = 0
	Encounter["StartCounting"] = Time.time
end
BlackDefinitive = CreateSprite("Bullets/Bones/Body","BelowBullet")
Corredor = CreateSprite("Overworld/Maps/Corredor","BelowBullet")
CorredorN = CreateSprite("Overworld/Maps/Corredor Noche","BelowBullet")
CorredorN.SetParent(Corredor)
PilarOw = CreateSprite("Overworld/Maps/PilarOW","BelowBullet")
PilarOwN = CreateSprite("Overworld/Maps/PilarOW Noche","BelowBullet")
PilarOw.SetParent(Corredor)
PilarOwN.SetParent(Corredor)
if Encounter["OverworldBones"] then
	Bones1 = CreateSprite("Overworld/Objects/WallBones1","BelowBullet")
	Bones1.SetParent(Corredor)
	Bones1.MoveTo(-938, -76)
	Bones2 = CreateSprite("Overworld/Objects/WallBones2","BelowBullet")
	Bones2.SetParent(Corredor)
	Bones2.MoveTo(-938, -76)
	Bones3 = CreateSprite("Overworld/Objects/WallBones3","BelowBullet")
	Bones3.SetParent(Corredor)
	Bones3.MoveTo(-938, -76)
	Bones4 = CreateSprite("Overworld/Objects/WallBones4","BelowBullet")
	Bones4.SetParent(Corredor)
	Bones4.MoveTo(-938, -76)
	if Encounter["Filled"] then
		Note = CreateSprite("Overworld/Objects/Note","BelowBullet")
		Note.SetParent(Corredor)
		Note.MoveTo(-1126, -180)
	end
end
SavePoint = CreateSprite("Overworld/Objects/Save Point/1","BelowBullet")
SavePoint.SetAnimation({"Overworld/Objects/Save Point/1","Overworld/Objects/Save Point/2"}, 0.16)
Box1 = CreateSprite("Overworld/Objects/Box","BelowBullet")
EggDog = CreateSprite("Overworld/Characters/Egg Dog","BelowBullet")
Pilares = {CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top"), CreateSprite("Overworld/Maps/Pilar","Top")}
Black = CreateSprite("Bullets/Bones/Body","Top")
if Encounter["CajaL"] then
	Encounter["CajaL"].SendToTop()
	for i=1,#Encounter["Dialogues"][1].DLetras do
		Encounter["Dialogues"][1].DLetras[i].SendToTop()
	end
end
Frisk.SetParent(Corredor)
SavePoint.SetParent(Corredor)
Box1.SetParent(Corredor)
EggDog.SetParent(Corredor)
for i=1,#Pilares do
	Pilares[i].SetParent(Corredor)
end
Black.color = {0,0,0}
BlackDefinitive.color = {0,0,0}
Black.Scale(640/5, 480)
BlackDefinitive.Scale(640/5, 480)
if Encounter["Alternative"] == 2 then
	FriskDirection = Encounter["Important"]["Direction"]
	Frisk.MoveTo(Encounter["Important"]["X"], Encounter["Important"]["Y"])
elseif not Encounter["OverworldBones"] then
	Frisk.MoveTo(-1159, -136)
else
	Frisk.SendToTop()
	Bones3.SendToTop()
	Bones4.SendToTop()
	for i=1,#Pilares do
		Pilares[i].SendToTop()
	end
	Frisk.MoveTo(-1080, -97)
	FriskDirection = "R"
	Frisk.rotation = 90
end
EggDog.SetPivot(0.5, 0)
if Encounter["Alternative"] == 2 then
	Corredor.MoveTo(Encounter["Important"]["CX"], Encounter["Important"]["CY"])
else
	Corredor.MoveTo(1400, 280)
end
Black.MoveTo(320, 240)
BlackDefinitive.MoveTo(320, 240)
SavePoint.MoveTo(-1160, -139)
Box1.MoveTo(-1060, -140)
EggDog.MoveTo(-1100, -100)
PilarOw.MoveTo(100, 40)
PilarOwN.MoveTo(100, 40)
Pilares[1].SetVar("Datos", -935)
Pilares[2].SetVar("Datos", -475)
Pilares[3].SetVar("Datos", -15)
Pilares[4].SetVar("Datos", 465)
Pilares[5].SetVar("Datos", 945)
Pilares[6].SetVar("Datos", 1347)
Pilares[7].SetVar("Datos", 1587)
Pilares[8].SetVar("Datos", 1827)
Pilares[9].SetVar("Datos", 2287)
EggDog.alpha = 0
Corredor.alpha = 0.5 + 0.5*math.sin(math.rad(180/12*(hour - 8)))
CorredorN.alpha = 0.5 + 0.5*math.sin(math.rad(180/12*(hour - 20)))
PilarOw.alpha = Corredor.alpha
PilarOwN.alpha = CorredorN.alpha
SavePoint.color = {0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8)))}
Box1.color = {0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8)))}
for i=1,#Pilares do
	Pilares[i].color = {0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8)))}
end

if Encounter["Special"] then
	Pressed = true
	Encounter["Special"] = nil
end
if Encounter["OverworldBones"] and Encounter["Filled"] then
	Note.color = {0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8))), 0.6 + 0.4*math.sin(math.rad(180/12*(hour - 8)))}
end
Encounter["Filled"] = nil

if Encounter["Alternative"] == 2 then
	timer = 0
	Encounter["Alternative"] = 3
else
	timer = -60
end
tableaux = 0
Items = {}
InBox = {}

function Update()
	if not Pause then
		FraskoX = Frisk.x
		FriskUpdate()
		DialogUpdate()
		if timer == -70 and Boxes[1] and not Boxes[1].Activo then
			AlowFriskMovement(true, true)
			timer = 1
		elseif timer == -69 and Boxes[1] and not Boxes[1].Activo then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Box("[voice:papyrus]ESPERO TE GUSTE.[w:15]\r\r[MoveTo:414]- PAPYRUS.", "papyrus", "", "", 0, 400, nil, "", 1)
			else
				Box("[voice:papyrus]I HOPE YOU LIKE IT.[w:15]\r\r[MoveTo:414]- PAPYRUS.", "papyrus", "", "", 0, 400, nil, "", 1)
			end
			timer = -70
		elseif timer == -68 and Boxes[1] and not Boxes[1].Activo then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Box("[voice:papyrus]SI TIENES HAMBRE[w:15], PUSE UN\rPOCO DE ESPAGUETI DENTRO\rDE LA CAJA PARA TI.", "papyrus", "", "", 0, 400, nil, "", 1)
			else
				Box("[voice:papyrus]IF YOU'RE HUNGRY[w:15], I PUT\rSOME SPAGHETTI INSIDE\rTHE BOX FOR YOU.", "papyrus", "", "", 0, 400, nil, "", 1)
			end
			timer = -69
		elseif timer == -67 and Boxes[1] and not Boxes[1].Activo then
			AlowFriskMovement(true, true)
			timer = 1
		elseif timer == -66 and Boxes[1] and not Boxes[1].Activo then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Box("[waittall:10]. . . [waittall:1]Pero nada pasó.", "", "", "", 0, 80, nil, "", 1)
			else
				Box("[waittall:10]. . . [waittall:1]But nothing happened.", "", "", "", 0, 80, nil, "", 1)
			end
			timer = -67
		elseif timer == -65 then
			if not Heart then
				Heart = CreateSprite("Overworld/Objects/Soul","Top")
				Heart.color = Player.sprite.color
				Heart.MoveTo(164, 44)
			end
			if Heart.x == 164 and Input.Right == 1 then
				Heart.MoveTo(404, 44)
				Audio.PlaySound("pip")
			elseif Heart.x == 404 and Input.Left == 1 then
				Heart.MoveTo(164, 44)
				Audio.PlaySound("pip")
			end
			if Input.Confirm == 1 then
				if Heart.x == 164 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("Presionaste el interruptor.", "", "", "", 0, 80, nil, "", 1)
					else
						Box("You pressed the switch.", "", "", "", 0, 80, nil, "", 1)
					end
					timer = -66
					Pressed = true
				elseif Heart.x == 404 then
					Box("", "", "", "", 0, 0, nil, "", 1)
					AlowFriskMovement(true, true)
					timer = 1
				end
				Heart.Remove()
				Heart = nil
			end
		elseif timer == -64 and Encounter["Triggered"] then
			Encounter["Triggered"] = nil
			timer = -65
		elseif timer == -63 and Boxes[1] and not Boxes[1].Activo then
			timer = -64
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Box("[noskip]Te gustaría presionarlo?[w:10]\r\r[MoveTo:180]Si[w:5][MoveTo:420]No[func:Trigger][w:10000000000] ", "", "", "", 0, 80, nil, "", 1)
			else
				Box("[noskip]Would like to press it?[w:10]\r\r[MoveTo:180]Yes[w:5][MoveTo:420]No[func:Trigger][w:10000000000] ", "", "", "", 0, 80, nil, "", 1)
			end
		elseif timer == -62 then
			if not Cuadro then
				Cuadro = CreateSprite("Overworld/Text Boxes/Box "..GetAlMightyGlobal("Idioma"),"BelowBullet")
				Heart = CreateSprite("Overworld/Objects/Soul","BelowBullet")
				Heart.color = Player.sprite.color
				Cuadro.MoveTo(320, 240)
				Heart.MoveTo(60, 391)
			end
			if Input.Confirm == 1 then
				if Heart.x == 60 and Encounter["Items"][(Heart.y - 423)/-32] then
					table.insert(Encounter["InBox"], Encounter["Items"][(Heart.y - 423)/-32])
					table.remove(Encounter["Items"], (Heart.y - 423)/-32)
				elseif Heart.x == 352 and Encounter["InBox"][(Heart.y - 423)/-32] and #Encounter["Items"] < 8 then
					table.insert(Encounter["Items"], Encounter["InBox"][(Heart.y - 423)/-32])
					table.remove(Encounter["InBox"], (Heart.y - 423)/-32)
				end
				Inventory.SetInventory(Encounter["Items"])
				TextBox = nil
			elseif Input.Down == 1 then
				Heart.y = Heart.y - 32
			elseif Input.Up == 1 then
				Heart.y = Heart.y + 32
			elseif Input.Left == 1 and Heart.x == 352 and #InBox > 0 then
				Heart.x = 60
			elseif Input.Right == 1 and Heart.x == 60 and #Items > 0 then
				Heart.x = 352
			end
			if #Items == 0 and Heart.x == 60 then
				Heart.x = 352
			elseif #InBox == 0 and Heart.x == 352 then
				Heart.x = 60
			end
			if Heart.x == 60 then
				Heart.y = math.max(math.min(Heart.y, 391), 423 - 32*#Items)
			elseif Heart.x == 352 then
				Heart.y = math.max(math.min(Heart.y, 391), 423 - 32*#InBox)
			end
			if not TextBox then
				for i=1,8 do
					if Encounter["Items"][i] then
						if Encounter["Items"][i] == "Pie" then
							Items[i] = "Butterscotch[MoveX:6]Pie"
						elseif Encounter["Items"][i] == "Pay" then
							Items[i] = "Pay[MoveX:6]de[MoveX:6]Caramelo"
						elseif Encounter["Items"][i] == "SnowPiece" then
							Items[i] = "Snowman[MoveX:6]Piece"
						elseif Encounter["Items"][i] == "P. Nieve" then
							Items[i] = "Pedazo[MoveX:6]de[MoveX:6]Nieve"
						elseif Encounter["Items"][i] == "L. Hero" then
							Items[i] = "Legendary[MoveX:6]Hero"
						elseif Encounter["Items"][i] == "Héroe L." then
							Items[i] = "Héroe[MoveX:6]Legendario"
						elseif Encounter["Items"][i] == "C. Spaghetti" then
							Items[i] = "Cold[MoveX:6]Spaghetti"
						elseif Encounter["Items"][i] == "Espagueti F." then
							Items[i] = "Espagueti[MoveX:6]Frío"
						end
					elseif Items[i] then
						table.remove(Items, i)
					end
				end
				for i=1,10 do
					if Encounter["InBox"][i] then
						if Encounter["InBox"][i] == "Pie" then
							InBox[i] = "Butterscotch[MoveX:6]Pie"
						elseif Encounter["InBox"][i] == "Pay" then
							InBox[i] = "Pay[MoveX:6]de[MoveX:6]Caramelo"
						elseif Encounter["InBox"][i] == "SnowPiece" then
							InBox[i] = "Snowman[MoveX:6]Piece"
						elseif Encounter["InBox"][i] == "P. Nieve" then
							InBox[i] = "Pedazo[MoveX:6]de[MoveX:6]Nieve"
						elseif Encounter["InBox"][i] == "L. Hero" then
							InBox[i] = "Legendary[MoveX:6]Hero"
						elseif Encounter["InBox"][i] == "Héroe L." then
							InBox[i] = "Héroe[MoveX:6]Legendario"
						elseif Encounter["InBox"][i] == "C. Spaghetti" then
							InBox[i] = "Cold[MoveX:6]Spaghetti"
						elseif Encounter["InBox"][i] == "Espagueti F." then
							InBox[i] = "Espagueti[MoveX:6]Frío"
						end
					elseif InBox[i] then
						table.remove(InBox, i)
					end
				end
				Dialog("[instant]"..(Items[1] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:376]"..(Items[2] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:344]"..(Items[3] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:312]"..(Items[4] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:280]"..(Items[5] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:248]"..(Items[6] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:216]"..(Items[7] or "[color:992B2B][MoveTo:92][MoveY:10]________________________").."\r[MoveToY:184]"..(Items[8] or "[color:992B2B][MoveTo:92][MoveY:10]________________________"), {X = 79, Y = 408}, nil, nil, 1)
				Dialog("[instant]"..(InBox[1] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:376]"..(InBox[2] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:344]"..(InBox[3] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:312]"..(InBox[4] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:280]"..(InBox[5] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:248]"..(InBox[6] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:216]"..(InBox[7] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:184]"..(InBox[8] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:152]"..(InBox[9] or "[color:992B2B][MoveTo:384][MoveY:10]_________________").."\r[MoveToY:120]"..(InBox[10] or "[color:992B2B][MoveTo:384][MoveY:10]_________________"), {X = 371, Y = 408}, nil, nil, 2)
				DialogUpdate()
				DialogUpdate()
				DialogUpdate()
				DialogUpdate()
				TextBox = true
			end
			if Input.Cancel == 1 then
				Dialog("", "", "", "", 1)
				Dialog("", "", "", "", 2)
				Cuadro.Remove()
				Heart.Remove()
				TextBox = nil
				Cuadro = nil
				Heart = nil
				AlowFriskMovement(true, true)
				timer = 1
			end
		elseif timer == -61 then
			if not SecondsDisplayed or GetAlMightyGlobal("Seconds") ~= SecondsDisplayed then
				SecondsDisplayed = GetAlMightyGlobal("Seconds")
				if GetAlMightyGlobal("Hours") > 0 then
					if GetAlMightyGlobal("Minutes") >= 10 then
						if GetAlMightyGlobal("Seconds") >= 10 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						end
					else
						if GetAlMightyGlobal("Seconds") >= 10 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":0"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":0"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":0"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:411]"..GetAlMightyGlobal("Hours")..":0"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						end
					end
				else
					if GetAlMightyGlobal("Minutes") >= 10 then
						if GetAlMightyGlobal("Seconds") >= 10 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:433]"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:433]"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:433]"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:433]"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						end
					else
						if GetAlMightyGlobal("Seconds") >= 10 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:448]"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:448]"..GetAlMightyGlobal("Minutes")..":"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:448]"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rÚltimo Corredor\r\r[MoveTo:168]Archivo ya guardado.", {X = 140, Y = 307}, nil, nil, 1)
							else
								Dialog("[instant][color:ffff00]Chara[MoveTo:280]LV[MoveTo:316]19[MoveTo:448]"..GetAlMightyGlobal("Minutes")..":0"..GetAlMightyGlobal("Seconds").."\rLast Corridor\r\r[MoveTo:168]File already saved.", {X = 140, Y = 307}, nil, nil, 1)
							end
						end
					end
				end
				DialogUpdate()
				DialogUpdate()
				DialogUpdate()
				DialogUpdate()
			end
			if not Cuadro then
				Cuadro = CreateSprite("Overworld/Text Boxes/Save File","BelowBullet")
				Cuadro.MoveTo(320, 240)
				Audio.PlaySound("save")
			elseif Input.Confirm == 1 or Input.Cancel == 1 then
				Dialog("", "", "", "", 1)
				Cuadro.Remove()
				Cuadro = nil
				SecondsDisplayed = nil
				AlowFriskMovement(true, true)
				timer = 1
			end
		elseif timer >= -60 and timer < 0 then
			timer = timer + 1
		elseif timer == 0 and Black.alpha > 0 then
			Black.alpha = Black.alpha - 0.04
			if Black.alpha <= 0 then
				timer = 1
				if not Encounter["OverworldBones"] then
					AlowFriskMovement(true, true)
				end
			end
		elseif timer == 1 then
			if Encounter["OverworldBones"] and (Input.Down == 1 or Input.Up == 1 or Input.Left == 1 or Input.Right == 1) and not FraskoParado and not FraskoAnimar then
				if not FraskoWevon then
					FraskoAnimar = 0
					FraskoWevon = 1
				elseif FraskoWevon and FraskoWevon < 3 then
					FraskoAnimar = 0
					FraskoWevon = FraskoWevon + 1
				elseif FraskoWevon and FraskoWevon == 3 then
					Frisk.rotation = 0
					FriskDirection = "D"
					Frisk.y = Frisk.y - 9
					Frisk.x = -1108
					AlowFriskMovement(true, true)
					Audio.PlaySound("st")
					FraskoParado = true
					FraskoWevon = nil
				end
			end
			if FraskoAnimar then
				FraskoAnimar = FraskoAnimar + 1
				Frisk.x = -1080 + 2*math.sin(math.rad(360/10*FraskoAnimar))
				if FraskoAnimar == 10 then
					FraskoAnimar = nil
				end
			end
			if Frisk.x >= -100 and Encounter["Alternative"] ~= 2 then
				EggDog.alpha = 1
			end
			if Frisk.x == 221 then
				timer = 2
				AlowFriskMovement(false, false)
				FriskDirection = "R"
			end
			------------------------- Infinite  Corridor -----------------------------
				if Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 1 and Frisk.x >= -385 and not Entered then
					AlowFriskMovement(false, false)
					FriskAuto("Right")
					Entered = 0
					PilarOw.alpha = 0
					PilarOwN.alpha = 0
				elseif Entered and Entered < 20 and Frisk.x >= -145 then
					Entered = Entered + 1
					Frisk.x = Frisk.x - 240
					Corredor.x = Corredor.x + 240
				end
			--------------------------- Egg Dog  Event -------------------------------
				if EggDog.alpha == 1 and Frisk.x >= -1135 and Frisk.x <= -1065 and Frisk.y >= -115 and Frisk.y <= -85 then
					AlowFriskMovement(false, false)
					timer = 5000
				end
			--------------------------- Map  Collision -------------------------------
				if Frisk.y == -199 then
					Frisk.y = Frisk.y + 3
				end
				if Frisk.y == -61 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
				if Frisk.x == -1180 then
					Frisk.x = Frisk.x + 3
				end
			-------------------------- Bones  Collision ------------------------------
				if Encounter["OverworldBones"] then
					if Frisk.y <= -187 and Frisk.x == -931 then
						Frisk.x = Frisk.x - 3
					end
					if Frisk.y <= -187 and Frisk.x == -877 then
						Frisk.x = Frisk.x + 3
					end
					if Frisk.x >= -931 and Frisk.x <= -877 and Frisk.y == -187 then
						Frisk.y = Frisk.y + 3
					end
					if Frisk.y >= -106 and Frisk.y <= -88 and Frisk.x == -979 then
						Frisk.x = Frisk.x - 3
					end
					if Frisk.y >= -106 and Frisk.y <= -88 and Frisk.x == -922 then
						Frisk.x = Frisk.x + 3
					end
					if Frisk.x >= -979 and Frisk.x <= -922 and Frisk.y == -88 then
						Frisk.y = Frisk.y + 3
					end
					if Frisk.x >= -979 and Frisk.x <= -922 and Frisk.y == -106 then
						if Input.Down > 0 then
							Frisk.y = Frisk.y - 6
							FriskDirection = "D"
						else
							Frisk.y = Frisk.y - 3
						end
					end
					if Frisk.y >= -160 and Frisk.y <= -133 and Frisk.x == -955 then
						Frisk.x = Frisk.x - 3
					end
					if Frisk.y >= -160 and Frisk.y <= -133 and Frisk.x == -901 then
						Frisk.x = Frisk.x + 3
					end
					if Frisk.x >= -955 and Frisk.x <= -901 and Frisk.y == -133 then
						Frisk.y = Frisk.y + 3
					end
					if Frisk.x >= -955 and Frisk.x <= -901 and Frisk.y == -160 then
						if Input.Down > 0 then
							Frisk.y = Frisk.y - 6
							FriskDirection = "D"
						else
							Frisk.y = Frisk.y - 3
						end
					end
				end
			---------------------------- Bones  Layer --------------------------------
				if Frisk.y >= -73 then
					PilarOw.SendToTop()
					PilarOwN.SendToTop()
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif Frisk.y <= -76 then
					Frisk.SendToTop()
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				end
				if Frisk.y >= -97 then
					if Bones2 and Bones3 and Bones4 then
						Bones2.SendToTop()
						Bones3.SendToTop()
						Bones4.SendToTop()
					end
					Box1.SendToTop()
					SavePoint.SendToTop()
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif Frisk.y >= -145 and Frisk.y <= -100 then
					Frisk.SendToTop()
					if Bones3 and Bones4 then
						Bones3.SendToTop()
						Bones4.SendToTop()
					end
					if Frisk.y >= -142 then
						Box1.SendToTop()
						SavePoint.SendToTop()
					end
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif Frisk.y <= -148 then
					Frisk.SendToTop()
					if Bones4 then
						Bones4.SendToTop()
					end
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				end
			----------------------------- Note Event ---------------------------------
				if Input.Confirm == 1 and Note and ((Frisk.y < -172 and Frisk.y > -196 and Frisk.x > -1144 and Frisk.x < -1102) or (Frisk.y == -172 and Frisk.x >= -1144 and Frisk.x <= -1102 and FriskDirection == "D") or (Frisk.y == -196 and Frisk.x >= -1144 and Frisk.x <= -1102 and FriskDirection == "U") or (Frisk.x == -1144 and Frisk.y >= -196 and Frisk.y <= -172 and FriskDirection == "R") or (Frisk.x == -1102 and Frisk.y >= -196 and Frisk.y <= -172 and FriskDirection == "L")) then
					timer = -68
					AlowFriskMovement(false, false)
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("Hay una nota en el suelo.", "", "", "", 0, 400, nil, "", 1)
					else
						Box("There's a note on the floor.", "", "", "", 0, 400, nil, "", 1)
					end
				end
			------------------------- Pilar 1  Collision -----------------------------
				if Frisk.y >= -97 and Frisk.x == -940 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -97 and Frisk.x == -787 then
					Frisk.x = Frisk.x + 3
				end
				if Frisk.x >= -941 and Frisk.x <= -787 and Frisk.y == -97 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
			------------------------- Pilar 2  Collision -----------------------------
				if Frisk.y >= -97 and Frisk.x == -700 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -97 and Frisk.x == -547 then
					Frisk.x = Frisk.x + 3
				end
				if Frisk.x >= -701 and Frisk.x <= -547 and Frisk.y == -97 then
					if Input.Down > 0 then
						if Input.Down > 0 then
							Frisk.y = Frisk.y - 6
							FriskDirection = "D"
						else
							Frisk.y = Frisk.y - 3
						end
					else
						Frisk.y = Frisk.y - 3
					end
				end
			------------------------- Pilar 3  Collision -----------------------------
				if Frisk.y >= -97 and Frisk.x == -460 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -97 and Frisk.x == -307 then
					Frisk.x = Frisk.x + 3
				end
				if Frisk.x >= -461 and Frisk.x <= -307 and Frisk.y == -97 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
			------------------------- Pilar 4  Collision -----------------------------
				if Frisk.y >= -97 and Frisk.x == -220 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -97 and Frisk.x == -67 then
					Frisk.x = Frisk.x + 3
				end
				if Frisk.x >= -221 and Frisk.x <= -67 and Frisk.y == -97 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
			------------------------- Pilar 5  Collision -----------------------------
				if Frisk.y >= -97 and Frisk.y <= -67 and Frisk.x == 23 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -97 and Frisk.y <= -67 and Frisk.x == 170 then
					Frisk.x = Frisk.x + 3
				end
				if Frisk.x >= 23 and Frisk.x <= 170 and Frisk.y == -97 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
				if Frisk.x >= 23 and Frisk.x <= 170 and Frisk.y == -67 then
					Frisk.y = Frisk.y + 3
				end
				if Input.Confirm == 1 then
					if Frisk.x >= 68 and Frisk.x <= 131 and Frisk.y == -64 then
						if not Pressed then
							timer = -63
							AlowFriskMovement(false, false)
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("Hay un interruptor detrás de\reste pilar.", "", "", "", 0, 80, nil, "", 1)
							else
								Box("There's a switch behind this\rpillar.", "", "", "", 0, 80, nil, "", 1)
							end
						else
							timer = -67
							AlowFriskMovement(false, false)
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("Ya presionaste este interruptor.", "", "", "", 0, 80, nil, "", 1)
							else
								Box("You already pressed this switch.", "", "", "", 0, 80, nil, "", 1)
							end
						end
					end
				end
			--------------------------- Box  Collision -------------------------------
				if Frisk.x >= -1099 and Frisk.x <= -1021 and Frisk.y == -139 then
					Frisk.y = Frisk.y + 3
				end
				if Frisk.x >= -1099 and Frisk.x <= -1021 and Frisk.y == -181 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
				if Frisk.y >= -182 and Frisk.y <= -138 and Frisk.x == -1099 then
					Frisk.x = Frisk.x - 3
				end
				if Frisk.y >= -182 and Frisk.y <= -138 and Frisk.x == -1021 then
					Frisk.x = Frisk.x + 3
				end
				if Input.Confirm == 1 and timer == 1 then
					if Frisk.x >= -1099 and Frisk.x <= -1021 and Frisk.y == -136 and FriskDirection == "D" then
						timer = -62
						AlowFriskMovement(false, false)
					end
					if Frisk.x >= -1099 and Frisk.x <= -1021 and Frisk.y == -184 and FriskDirection == "U" then
						timer = -62
						AlowFriskMovement(false, false)
					end
					if Frisk.y >= -182 and Frisk.y <= -138 and Frisk.x == -1102 and FriskDirection == "R" then
						timer = -62
						AlowFriskMovement(false, false)
					end
					if Frisk.y >= -182 and Frisk.y <= -138 and Frisk.x == -1018 and FriskDirection == "L" then
						timer = -62
						AlowFriskMovement(false, false)
					end
				end
			------------------------ Save Point Collision ----------------------------
				if Frisk.x <= -1119 and Frisk.y == -139 then
					Frisk.y = Frisk.y + 3
				end
				if Frisk.x <= -1119 and Frisk.y == -181 then
					if Input.Down > 0 then
						Frisk.y = Frisk.y - 6
						FriskDirection = "D"
					else
						Frisk.y = Frisk.y - 3
					end
				end
				if Frisk.y >= -181 and Frisk.y <= -139 and Frisk.x == -1120 then
					Frisk.x = Frisk.x + 3
				end
				if Input.Confirm == 1 and timer == 1 then
					if Frisk.x <= -1120 and Frisk.y == -136 and FriskDirection == "D" then
						timer = -61
						AlowFriskMovement(false, false)
					end
					if Frisk.x <= -1120 and Frisk.y == -184 and FriskDirection == "U" then
						timer = -61
						AlowFriskMovement(false, false)
					end
					if Frisk.y >= -181 and Frisk.y <= -139 and Frisk.x == -1117 and FriskDirection == "L" then
						timer = -61
						AlowFriskMovement(false, false)
					end
				end
			--------------------------------------------------------------------------
			if Frisk.x ~= FraskoX and not FraskoWevon then
				if Frisk.absx > 321 and Corredor.x > -760 then
					Corredor.x = Corredor.x - 3
				elseif Frisk.absx < 319 and Corredor.x < 1400 then
					Corredor.x = Corredor.x + 3
				end
			end
		elseif timer >= 2 and timer < 122 then
			timer = timer + 1
		elseif timer == 122 and Corredor.x > -100 then
			Corredor.x = Corredor.x - 1
			if Pilares[8].x == 469 then
				Papyrus = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
				Papyrus.SetPivot(0.5, 0)
				Papyrus.SetParent(Corredor)
				Papyrus.MoveTo(469, math.max(Frisk.y - 4, -198))
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			end
			if Corredor.x == -100 then
				timer = 123
			end
		elseif timer >= 123 and timer < 183 then
			timer = timer + 1
			if timer == 183 and Frisk.y >= -80 then
				timer = 1000
			end
			Box("[noskip][next]", "", "", "", 0, 800, nil, "", 1)
		end
		if Entered then
			if timer == 183 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]Qué demonios te\rtomó demasiado?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]What the hell took\ryou so long?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				end
				timer = 184
			elseif timer == 184 and Boxes[1] and not Boxes[1].Activo then
				timer = 185
				Audio.PlaySound("spawn")
				Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
				Paps.SetPivot(0.5, 0)
				Paps.SetParent(Corredor)
				Paps.MoveTo(Papyrus.x, Papyrus.y)
				Paps.alpha = 0
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			elseif timer >= 185 and timer < 205 then
				Paps.alpha = Paps.alpha + 1/20*(timer - 184)
				timer = timer + 1
			elseif timer == 205 then
				timer = 2000
			end
		elseif Encounter["OverworldBones"] then
			if timer == 183 and Boxes[1] and not Boxes[1].Activo then
				Box("[voice:papyrus][waittall:3]...", "papyrus", "", "", 0, 400, nil, "", 1)
				timer = 184
			elseif timer == 184 and Boxes[1] and not Boxes[1].Activo then
				if Encounter["NoDialogBones"] then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[voice:papyrus]Regresaste...", "papyrus", "", "", 0, 400, nil, "", 1)
					else
						Box("[voice:papyrus]You came back...", "papyrus", "", "", 0, 400, nil, "", 1)
					end
					timer = 186
				else
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[voice:papyrus]Regresaste...[w:10]\nNo sé cómo evitaste\rmis huesos...", "papyrus", "", "", 0, 400, nil, "", 1)
					else
						Box("[voice:papyrus]You came back...[w:10]\nI don't know how you\ravoided my bones...", "papyrus", "", "", 0, 400, nil, "", 1)
					end
					timer = 185
				end
			elseif timer == 185 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[voice:papyrus]Pero eso no\rimporta...", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[voice:papyrus]But that doesn't\rmatter...", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 186
			elseif timer == 186 and Boxes[1] and not Boxes[1].Activo then
				timer = 187
				Audio.PlaySound("spawn")
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
				else
					Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
				end
				Paps.SetPivot(0.5, 0)
				Paps.SetParent(Corredor)
				Paps.MoveTo(Papyrus.x, Papyrus.y)
				Paps.alpha = 0
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			elseif timer >= 187 and timer < 207 then
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
					Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
					Paps.alpha = 1
				else
					Paps.alpha = Paps.alpha + 1/20*(timer - 186)
				end
				timer = timer + 1
			elseif timer == 207 then
				if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
					Papyrus.Remove()
					Papyrus = nil
				end
				if not Pressed then
					if  Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus][SetAnimation:Worried 2]Listo para una\rdoble lección?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus][SetAnimation:Worried 2]Ready for a double\rlesson?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					elseif  Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 2 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Listo para otra\rlec-[func:Trigger][StopAnimation][SetCara:Nyeh 1][w:1000000000000] ", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Ready for a another\rles-[func:Trigger][StopAnimation][SetCara:Nyeh 1][w:1000000000000] ", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						end
						timer = 4000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus][SetAnimation:Worried 2]Listo para otra\rlección?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus][SetAnimation:Worried 2]Ready for another\rlesson?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					end
				else
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Listo para otra\rlec-[func:Trigger][StopAnimation][SetCara:Nyeh 1][w:10] [next]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Ready for another\rles-[func:Trigger][StopAnimation][SetCara:Nyeh 1][w:10] [next]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					end
					timer = 3000
				end
			end
		elseif GetAlMightyGlobal("ShortDialog") then
			if timer == 183 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[voice:papyrus][SetAnimation:Worried 2]No entiendo.[StopAnimation][SetCara:Worried 1][w:10][SetCara:Sad]\nPor qué [effect:shake]mataste[effect:none]\ra mis amigos?", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[voice:papyrus][SetAnimation:Worried 2]I don't understand.[StopAnimation][SetCara:Worried 1][w:10][SetCara:Sad]\nWhy did you [effect:shake]kill[effect:none]\rmy friends?", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 184
			elseif timer == 184 and Boxes[1] and not Boxes[1].Activo then
				timer = 185
				Audio.PlaySound("spawn")
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
				else
					Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
				end
				Paps.SetPivot(0.5, 0)
				Paps.SetParent(Corredor)
				Paps.MoveTo(Papyrus.x, Papyrus.y)
				Paps.alpha = 0
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			elseif timer >= 185 and timer < 205 then
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
					Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
					Paps.alpha = 1
				else
					Paps.alpha = Paps.alpha + 1/20*(timer - 184)
				end
				timer = timer + 1
			elseif timer == 205 then
				if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
					Papyrus.Remove()
					Papyrus = nil
				end
				if not Pressed then
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus]Es hora de aprender tu\rdoble lección.", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus]It's time to learn your\rdouble lesson.", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					elseif Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 2 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Es hora de aprender tu\rlec-[func:Trigger][w:1000000000000] ", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]It's time to learn your\rles-[func:Trigger][w:1000000000000] ", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 4000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus]Es hora de aprender tu\rlección.", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus]It's time to learn your\rlesson.", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					end
				else
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus]Es hora de aprender tu\rlec-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus]It's time to learn your\rles-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
					end
					timer = 3000
				end
			end
		else
			if timer == 183 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]No entiendo.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]I don't understand.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 184
			elseif timer == 184 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Qué tiene de\rbueno matar\rgente?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]What's so good\rabout killing\rpeople?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 185
			elseif timer == 185 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]Hay algún tipo de\rbroma que me estoy\rperdiendo?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]Is there some sort\rof inside joke i'm\rmissing?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				end
				timer = 186
			elseif timer == 186 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]No[w:10], eso no puede\rser...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]No[w:10], that can't be\rit...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				end
				timer = 187
			elseif timer == 187 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Cuáles fueron...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]What were...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 188
			elseif timer == 188 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Cuáles fueron sus\rúltimas palabras?", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]What were his last\rwords?", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				end
				timer = 189
			elseif timer == 189 and Boxes[1] and not Boxes[1].Activo then
				timer = 190
			elseif timer >= 190 and timer < 370 then
				timer = timer + 1
			elseif timer == 370 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Me dijo que\rsería una broma.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]He told me it\rwould be a pun.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 371
			elseif timer == 371 and Boxes[1] and not Boxes[1].Activo then
				Box("[noskip][voice:papyrus]. . .", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				timer = 372
			elseif timer == 372 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Él es muy gracioso[w:10],\rverdad?", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]He's very funny[w:10],\rright?", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				end
				timer = 373
			elseif timer == 373 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Scared 2]Él puede ser\rmolesto a veces[StopAnimation][SetCara:Scared 1][w:10][SetAnimation:Scared 2],\rsí.[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Scared 2]He can be\rannoying at times[StopAnimation][SetCara:Scared 1][w:10][SetAnimation:Scared 2],\ryeah.[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				end
				timer = 374
			elseif timer == 374 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Y flojo también...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]And lazy too...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 375
			elseif timer == 375 and Boxes[1] and not Boxes[1].Activo then
				Box("[noskip][voice:papyrus]. . .", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				timer = 376
			elseif timer == 376 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Pero él estaba\rconmigo cuando\rlo necesitaba.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]But he was with\rme when i really\rneeded it.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 377
			elseif timer == 377 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Pero ahora él\restá...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]But now he's...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				end
				timer = 378
			elseif timer == 378 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Y-[StopAnimation][SetCara:Worried 1][w:10][SetAnimation:Worried 2]y Undyne también...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Worried 2]A-[StopAnimation][SetCara:Worried 1][w:10][SetAnimation:Worried 2]and Undyne too...[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
				timer = 379
			elseif timer == 379 and Boxes[1] and not Boxes[1].Activo then
				timer = 380
			elseif timer >= 380 and timer < 440 then
				timer = timer + 1
			elseif timer == 440 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][stareffect:shake][voice:papyrus][waittall:6][effect:shake]Tú l... [w:10]los mataste.", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][stareffect:shake][voice:papyrus][waittall:6][effect:shake]You k... [w:10]killed them.", "papyrus", "Sad", "", 0, 400, nil, "", 1)
				end
				timer = 441
			elseif timer == 441 and Boxes[1] and not Boxes[1].Activo then
				timer = 442
				Audio.PlaySound("spawn")
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
				else
					Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
				end
				Paps.SetPivot(0.5, 0)
				Paps.SetParent(Corredor)
				Paps.MoveTo(Papyrus.x, Papyrus.y)
				Paps.alpha = 0
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			elseif timer >= 442 and timer < 462 then
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
					Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
					Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
					Paps.alpha = 1
				else
					Paps.alpha = Paps.alpha + 1/20*(timer - 441)
				end
				timer = timer + 1
			elseif timer >= 462 and timer < 512 then
				timer = timer + 1
				if timer == 492 then
					Black.SendToTop()
					Black.alpha = 1
					Audio.PlaySound("st")
				elseif timer == 512 then
					Black.alpha = 0
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then 
						Papyrus.alpha = 0
					else
						Papyrus.Remove()
						Papyrus = nil
					end
					Paps.alpha = 0
					Corredor.x = 100
					Audio.PlaySound("st")
				end
			elseif timer >= 512 and timer < 522 then
				timer = timer + 1
				if timer == 522 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus]Humano.", "papyrus", "", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus]Human.", "papyrus", "", "", 0, 400, nil, "", 1)
					end
				end
			elseif timer == 522 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Permíteme contarte\ralgunos sentimientos\rmuy complejos.", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Allow me to tell you\rabout some very\rcomplex feelings.", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 523
			elseif timer == 523 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Sentimientos como...", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Feelings like...", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 524
			elseif timer == 524 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Perder a alguien que\ramas.", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Losing someone you\rlove.", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 525
			elseif timer == 525 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Perder a todos los\rque amas.", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Losing everyone you\rlove.", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 526
			elseif timer == 526 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Estar solo y asustado.", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Being alone and scared.", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 527
			elseif timer == 527 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Pararse frente a\ralguien que quiere\rlastimarte.", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]Standing in front of\rsomeone who wants to\rhurt you.", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 528
			elseif timer == 528 and Boxes[1] and not Boxes[1].Activo then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus]Estos sentimientos[waittall:47]...", "papyrus", "", "", 0, 400, nil, "", 1)
				else
					Box("[noskip][voice:papyrus]These feelings[waittall:47]...", "papyrus", "", "", 0, 400, nil, "", 1)
				end
				timer = 529
			elseif timer == 529 then
				Corredor.x = Corredor.x - 1
				if Pilares[8].x == 469 then
					Paps.alpha = 1
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then 
						Papyrus.alpha = 1
					end
				end
				if Corredor.x == -100 then
					timer = 530
				end
			elseif timer == 530 and Boxes[1] and not Boxes[1].Activo then
				if not Pressed then
					if Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 2 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Deben ser los que\rsientes ahora\rmi-[func:Trigger][SetCara:Nyeh 1][w:1000000000000] ", "papyrus", "Sad", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]They must be what\ryou are feeling\rri-[func:Trigger][SetCara:Nyeh 1][w:1000000000000] ", "papyrus", "Sad", "", 0, 400, nil, "", 1)
						end
						timer = 4000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Deben ser los que\rsientes ahora\rmismo.", "papyrus", "Sad", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]They must be what\ryou are feeling\rright now.", "papyrus", "Sad", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					end
				else
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus]Deben ser los que\rsientes ahora\rmi-[func:Trigger][SetCara:Nyeh 1][w:10] [next]", "papyrus", "Sad", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus]They must be what\ryou are feeling\rri-[func:Trigger][SetCara:Nyeh 1][w:10] [next]", "papyrus", "Sad", "", 0, 400, nil, "", 1)
					end
					timer = 3000
				end
			end
		end
		if timer >= 1000 and timer < 2000 and Boxes[1] and not Boxes[1].Activo then
			timer = timer + 1
			if not GetAlMightyGlobal("PilarEasterEgg") then
				if timer == 1001 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Disculpe sr.\rpilar[StopAnimation][SetCara:Worried 1][w:10][SetAnimation:Worried 2], has visto\ral humano?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Excuse me mr.\rpillar[StopAnimation][SetCara:Worried 1][w:10][SetAnimation:Worried 2], have you\rseen the human?[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1002 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]Estaba justo ahí\rhace un minuto...[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]He was right there\rjust a minute ago...[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
					end
				elseif timer >= 1003 and timer < 1043 then
					if timer%40 == 3 or timer%40 == 23 then
						Papyrus.Set("Overworld/Characters/Papyrus/D1")
					elseif timer%40 == 13 then
						Papyrus.Set("Overworld/Characters/Papyrus/D2")
					elseif timer%40 == 33 then
						Papyrus.Set("Overworld/Characters/Papyrus/D3")
					end
					Papyrus.y = Papyrus.y - 2
				elseif timer == 1043 then
					Papyrus.Set("Overworld/Characters/Papyrus/Normal")
				elseif timer == 1073 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Normal 2]Oh[StopAnimation][SetCara:Normal 1][w:10][SetAnimation:Normal 2], ahí estas.[StopAnimation][SetCara:Normal 1]", "papyrus", "Normal 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Normal 2]Oh[StopAnimation][SetCara:Normal 1][w:10][SetAnimation:Normal 2], there you are.[StopAnimation][SetCara:Normal 1]", "papyrus", "Normal 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1074 then
					Box("[noskip][voice:papyrus][waittall:3]. . .", "papyrus", "Sad", "", 0, 400, nil, "", 1)
					timer = 183
					if tonumber(string.sub(GetAlMightyGlobal("Archivimentazo"), 7, 7)) < 1 then
						SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 6).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 8))
					end
					Encounter["SumarEasterEgg"] = true
				end
			elseif GetAlMightyGlobal("PilarEasterEgg") == 1 then
				if timer == 1001 then
					Box("[noskip][voice:papyrus][waittall:3]. . .?", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				elseif timer == 1002 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Disculpe sr.\rpilar[StopAnimation][SetCara:Worried 1][w:10][SetCara:Thinking 1][SetAnimation:Thinking 2], puede\rmoverse?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]Excuse me mr.\rpillar[StopAnimation][SetCara:Worried 1][w:10][SetCara:Thinking 1][SetAnimation:Thinking 2], can you\rmove?[StopAnimation][SetCara:Thinking 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1003 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]No puedo ver al\rhumano escondido\rdetrás de usted.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Worried 2]I can't see the\rhuman hiding behind\ryou.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1004 then
					Box("[noskip][voice:papyrus][waittall:6]. . .", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				elseif timer == 1005 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Bien![StopAnimation][SetCara:Angry 1][w:10][SetAnimation:Angry 2] quédate\rahí si quieres![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Fine![StopAnimation][SetCara:Angry 1][w:10][SetAnimation:Angry 2] stay there\rif you want![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer >= 1006 and timer < 1046 then
					if timer%40 == 6 or timer%40 == 26 then
						Papyrus.Set("Overworld/Characters/Papyrus/D1")
					elseif timer%40 == 16 then
						Papyrus.Set("Overworld/Characters/Papyrus/D2")
					elseif timer%40 == 36 then
						Papyrus.Set("Overworld/Characters/Papyrus/D3")
					end
					Papyrus.y = Papyrus.y - 2
				elseif timer == 1046 then
					Papyrus.Set("Overworld/Characters/Papyrus/Normal")
				elseif timer == 1076 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Muy bien humano.[StopAnimation][SetCara:Angry 1][w:10][SetAnimation:Angry 2]\nNo más escondidas.[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Very well human.[StopAnimation][SetCara:Angry 1][w:10][SetAnimation:Angry 2]\nNo more hiding.[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1077 then
					Audio.PlaySound("spawn")
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
					else
						Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
					end
					Paps.SetPivot(0.5, 0)
					Paps.SetParent(Corredor)
					Paps.MoveTo(Papyrus.x, Papyrus.y)
					Paps.alpha = 0
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif timer >= 1078 and timer < 1098 then
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
						Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
						Paps.alpha = 1
					else
						Paps.alpha = Paps.alpha + 1/20*(timer - 1077)
					end
				elseif timer == 1098 then
					if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
						Papyrus.Remove()
						Papyrus = nil
					end
					if not Pressed then
						if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("[voice:papyrus]Es hora de aprender tu\rdoble lección.", "papyrus", "", "", 0, 400, nil, "", 1)
							else
								Box("[voice:papyrus]It's time to learn your\rdouble lesson.", "papyrus", "", "", 0, 400, nil, "", 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("[voice:papyrus]Es hora de aprender tu\rlección.", "papyrus", "", "", 0, 400, nil, "", 1)
							else
								Box("[voice:papyrus]It's time to learn your\rlesson.", "papyrus", "", "", 0, 400, nil, "", 1)
							end
						end
						timer = 2000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Es hora de aprender tu\rlec-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]It's time to learn your\rles-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 3000
					end
					if tonumber(string.sub(GetAlMightyGlobal("Archivimentazo"), 7, 7)) < 2 then
						SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 6).."2"..string.sub(GetAlMightyGlobal("Archivimentazo"), 8))
					end
					Encounter["SumarEasterEgg"] = true
				end
			elseif GetAlMightyGlobal("PilarEasterEgg") == 2 then
				if timer == 1001 then
					Box("[noskip][voice:papyrus][waittall:3]. . .", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				elseif timer == 1002 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]En serio?[StopAnimation][SetCara:Thinking 1][w:10][SetCara:Scared 1][SetAnimation:Scared 2]\nVamos humano no\rte escondas.[StopAnimation][SetCara:Scared 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Thinking 2]Seriously?[StopAnimation][SetCara:Thinking 1][w:10][SetCara:Scared 1][SetAnimation:Scared 2]\nCome on human\rdon't hide.[StopAnimation][SetCara:Scared 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1003 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Scared 2]Solo quiero\renseñarte una\rlección.[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Scared 2]I just want to\rteach you a\rlesson.[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1004 then
					Box("[noskip][voice:papyrus][waittall:6]. . .", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				elseif timer == 1005 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Bien![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Fine![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer >= 1006 and timer < 1046 then
					if timer%40 == 6 or timer%40 == 26 then
						Papyrus.Set("Overworld/Characters/Papyrus/D1")
					elseif timer%40 == 16 then
						Papyrus.Set("Overworld/Characters/Papyrus/D2")
					elseif timer%40 == 36 then
						Papyrus.Set("Overworld/Characters/Papyrus/D3")
					end
					Papyrus.y = Papyrus.y - 2
				elseif timer == 1046 then
					Papyrus.Set("Overworld/Characters/Papyrus/Normal")
				elseif timer == 1076 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Esto no es un\rjuego humano.[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]This is not a game\rhuman.[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1077 then
					Audio.PlaySound("spawn")
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
					else
						Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
					end
					Paps.SetPivot(0.5, 0)
					Paps.SetParent(Corredor)
					Paps.MoveTo(Papyrus.x, Papyrus.y)
					Paps.alpha = 0
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif timer >= 1078 and timer < 1098 then
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
						Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
						Paps.alpha = 1
					else
						Paps.alpha = Paps.alpha + 1/20*(timer - 1077)
					end
				elseif timer == 1098 then
					if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
						Papyrus.Remove()
						Papyrus = nil
					end
					if not Pressed then
						if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 then
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("[voice:papyrus]Es hora de aprender tu\rdoble lección.", "papyrus", "", "", 0, 400, nil, "", 1)
							else
								Box("[voice:papyrus]It's time to learn your\rdouble lesson.", "papyrus", "", "", 0, 400, nil, "", 1)
							end
						else
							if GetAlMightyGlobal("Idioma") == "Spanish" then
								Box("[voice:papyrus]Es hora de aprender tu\rlección.", "papyrus", "", "", 0, 400, nil, "", 1)
							else
								Box("[voice:papyrus]It's time to learn your\rlesson.", "papyrus", "", "", 0, 400, nil, "", 1)
							end
						end
						timer = 2000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Es hora de aprender tu\rlec-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]It's time to learn your\rles-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 3000
					end
					if tonumber(string.sub(GetAlMightyGlobal("Archivimentazo"), 7, 7)) < 3 then
						SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 6).."3"..string.sub(GetAlMightyGlobal("Archivimentazo"), 8))
					end
					Encounter["SumarEasterEgg"] = true
				end
			elseif GetAlMightyGlobal("PilarEasterEgg") == 3 then
				if timer == 1001 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Vamos humano![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Come on human![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1002 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]No estamos aquí\rpara jugar a las\rescondidas![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]We are not here\rto play hide and\rseek![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1003 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Estamos aquí\rpara que aprendas\rtu lección![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]We are here to\rmake you learn\ryour lesson![StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1004 then
					Box("[noskip][voice:papyrus][waittall:6]. . .", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				elseif timer == 1005 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus]Suspiro...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus]Sigh...", "papyrus", "Sad", "", 0, 400, nil, "", 1)
					end
				elseif timer >= 1006 and timer < 1046 then
					if timer%40 == 6 or timer%40 == 26 then
						Papyrus.Set("Overworld/Characters/Papyrus/D1")
					elseif timer%40 == 16 then
						Papyrus.Set("Overworld/Characters/Papyrus/D2")
					elseif timer%40 == 36 then
						Papyrus.Set("Overworld/Characters/Papyrus/D3")
					end
					Papyrus.y = Papyrus.y - 2
				elseif timer == 1046 then
					Papyrus.Set("Overworld/Characters/Papyrus/Normal")
				elseif timer == 1076 then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Suficiente...[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					else
						Box("[noskip][voice:papyrus][SetAnimation:Angry 2]Enough...[StopAnimation][SetCara:Angry 1]", "papyrus", "Angry 1", "", 0, 400, nil, "", 1)
					end
				elseif timer == 1077 then
					Audio.PlaySound("spawn")
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
					else
						Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
					end
					Paps.SetPivot(0.5, 0)
					Paps.SetParent(Corredor)
					Paps.MoveTo(Papyrus.x, Papyrus.y)
					Paps.alpha = 0
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif timer >= 1078 and timer < 1098 then
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
						Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
						Paps.alpha = 1
					else
						Paps.alpha = Paps.alpha + 1/20*(timer - 1077)
					end
				elseif timer == 1098 then
					if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
						Papyrus.Remove()
						Papyrus = nil
					end
					if not Pressed then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus]Vayamos directo al\rgrano.", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus]Let's just get to the\rpoint.", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Vayamos directo al\rgra-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]Let's just get to the\rpo-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 3000
					end
					if tonumber(string.sub(GetAlMightyGlobal("Archivimentazo"), 7, 7)) < 4 then
						SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 6).."4"..string.sub(GetAlMightyGlobal("Archivimentazo"), 8))
					end
					Encounter["SumarEasterEgg"] = true
				end
			elseif GetAlMightyGlobal("PilarEasterEgg") == 4 then
				if timer == 1001 then
					Box("[noskip][voice:papyrus][waittall:6]. . .", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				elseif timer >= 1002 and timer < 1042 then
					if timer%40 == 6 or timer%40 == 26 then
						Papyrus.Set("Overworld/Characters/Papyrus/D1")
					elseif timer%40 == 16 then
						Papyrus.Set("Overworld/Characters/Papyrus/D2")
					elseif timer%40 == 36 then
						Papyrus.Set("Overworld/Characters/Papyrus/D3")
					end
					Papyrus.y = Papyrus.y - 2
				elseif timer == 1042 then
					Papyrus.Set("Overworld/Characters/Papyrus/Normal")
				elseif timer == 1072 then
					Audio.PlaySound("spawn")
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps = CreateSprite("Overworld/Characters/Papyrus/Normal","BelowBullet")
					else
						Paps = CreateSprite("Overworld/Characters/Papyrus/Bone","BelowBullet")
					end
					Paps.SetPivot(0.5, 0)
					Paps.SetParent(Corredor)
					Paps.MoveTo(Papyrus.x, Papyrus.y)
					Paps.alpha = 0
					for i=1,#Pilares do
						Pilares[i].SendToTop()
					end
				elseif timer >= 1073 and timer < 1093 then
					if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and not Pressed then
						Paps.MoveTo(Paps.x - 8/20, Paps.y + 21/20)
						Papyrus.MoveTo(Papyrus.x + 8/20, Papyrus.y - 21/20)
						Paps.alpha = 1
					else
						Paps.alpha = Paps.alpha + 1/20*(timer - 1072)
					end
				elseif timer == 1093 then
					if not (Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1) or Pressed then 
						Papyrus.Remove()
						Papyrus = nil
					end
					if not Pressed then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[voice:papyrus]Vayamos directo al\rgrano.", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[voice:papyrus]Let's just get to the\rpoint.", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 2000
					else
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Box("[noskip][voice:papyrus]Vayamos directo al\rgra-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						else
							Box("[noskip][voice:papyrus]Let's just get to the\rpo-[func:Trigger][w:10] [next]", "papyrus", "", "", 0, 400, nil, "", 1)
						end
						timer = 3000
					end
					if tonumber(string.sub(GetAlMightyGlobal("Archivimentazo"), 7, 7)) < 5 then
						SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 6).."5"..string.sub(GetAlMightyGlobal("Archivimentazo"), 8))
						Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 7}
					end
				end
			end
		elseif timer >= 2000 and timer < 3000 and Boxes[1] and not Boxes[1].Activo then
			timer = timer + 1
			if timer == 2001 then
				if Encounter["FUN"][1] == "Epic" and Encounter["FUN"][2] == 1 and string.sub(GetAlMightyGlobal("Archivimentazo"), 19, 19) == "0" then
					SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 18).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 20))
					Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 19}
				elseif Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 1 and string.sub(GetAlMightyGlobal("Archivimentazo"), 20, 20) == "0" then
					SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 19).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 21))
					Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 20}
				elseif Encounter["FUN"][1] == "Legendary" and Encounter["FUN"][2] == 2 and string.sub(GetAlMightyGlobal("Archivimentazo"), 21, 21) == "0" and Bark then
					SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 20).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 22))
					Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 21}
				end
				TipoFrisk = "N"
				Frisk.alpha = 0
				Heart = CreateSprite("Overworld/Objects/Soul","Top")
				Heart.color = Player.sprite.color
				Heart.MoveTo(Frisk.absx, Frisk.absy + Frisk.height/2)
				for i=1,#Pilares do
					Pilares[i - tableaux].Remove()
					table.remove(Pilares, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				if Bones1 and Bones2 and Bones3 and Bones4 then
					Bones1.Remove()
					Bones2.Remove()
					Bones3.Remove()
					Bones4.Remove()
					Bones1 = nil
					Bones2 = nil
					Bones3 = nil
					Bones4 = nil
				end
				if Note then
					Note.Remove()
					Note = nil
				end
				if Papyrus then
					Papyrus.Remove()
					Papyrus = nil
				end
				Paps.Remove()
				Paps = nil
				SavePoint.Remove()
				SavePoint = nil
				Box1.Remove()
				Box1 = nil
				EggDog.Remove()
				EggDog = nil
				Black.Remove()
				Black = nil
				PilarOw.Remove()
				PilarOw = nil
				PilarOwN.Remove()
				PilarOwN = nil
				Corredor.alpha = 0
				CorredorN.alpha = 0
				Audio.PlaySound("st")
			elseif timer == 2004 then
				Frisk.alpha = 1
				Heart.alpha = 0
			elseif timer == 2007 then
				Frisk.alpha = 0
				Heart.alpha = 1
				Audio.PlaySound("st")
			elseif timer == 2010 then
				Frisk.alpha = 1
				Heart.alpha = 0
			elseif timer == 2013 then
				Frisk.alpha = 0
				Heart.alpha = 1
				Heart.SetVar("diff", {48 - Heart.absx, 25 - Heart.absy})
				Audio.PlaySound("st")
			elseif timer >= 2033 and timer < 2053 then
				Heart.MoveTo(Heart.absx + Heart.GetVar("diff")[1]/20, Heart.absy + Heart.GetVar("diff")[2]/20)
				if timer == 2033 then
					Audio.PlaySound("start")
				end
			elseif timer >= 2053 then
				Heart.alpha = Heart.alpha - 0.05
				if Heart.alpha <= 0 then
					Heart.Remove()
					Frisk.Remove()
					Corredor.Remove()
					CorredorN.Remove()
					BlackDefinitive.Remove()
					Encounter.Call("PapsMoveTo", {320, 285})
					if Pressed then
						Encounter["phase"] = -1
						Encounter["flee"] = false
					end
					Encounter["enemies"][1].Call("SetActive", true)
					Encounter["enemies"][4].Call("SetActive", false)
					Encounter["nextwaves"] = {"Intro Phase 1"}
					State("DEFENDING")
				end
			end
		elseif timer >= 3000 and timer < 4000 then
			if timer == 3000 and Encounter["Triggered"] then
				Encounter["Triggered"] = nil
				timer = 3001
				NewAudio.CreateChannel("Terremoto")
				NewAudio.PlaySound("Terremoto", "Drill", true, 1)
				Shake = {Corredor.x, Corredor.y}
			elseif timer == 3001 and Boxes[1] and not Boxes[1].Activo then
				Box("[noskip][voice:papyrus][SetAnimation:Nyeh 2]Nyeh?[StopAnimation][SetCara:Nyeh 1]", "papyrus", "Nyeh 1", "", 0, 80, nil, "", 1)
				timer = 3002
			elseif timer == 3002 and Boxes[1] and not Boxes[1].Activo then
				Paps.Set("Overworld/Characters/Papyrus/Bone Left")
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[noskip][voice:papyrus][SetAnimation:Nyeh 2]Qué está pa[func:Trigger][StopAnimation][SetCara:WTH 1][SetAnimation:WTH 2]san-[StopAnimation][SetCara:WTH 2][w:100000000] ", "papyrus", "Nyeh 1", "", 0, 80, nil, "", 1)
				else
					Box("[noskip][voice:papyrus][SetAnimation:Nyeh 2]What is ha[func:Trigger][StopAnimation][SetCara:WTH 1][SetAnimation:WTH 2]ppe-[StopAnimation][SetCara:WTH 2][w:100000000] ", "papyrus", "Nyeh 1", "", 0, 80, nil, "", 1)
				end
				timer = 3003
			elseif timer == 3003 and Encounter["Triggered"] then
				Encounter["Triggered"] = nil
				timer = 3004
				NewAudio.Stop("Terremoto")
				NewAudio.PlaySound("Terremoto", "LedgeBreak2", false, 1)
				Rocks = 0
				Rocas = {}
				for i=1,100 do
					table.insert(Rocas, {Sprite = CreateSprite("Overworld/Objects/Rock "..math.random(4),"Top"), X = 440 + 5*i, Y = math.random(500, 700), Rotation = math.random(360), Vel = 20*(-3 + 2*math.random(2))})
				end
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
			end
			if Rocks then
				Rocks = Rocks + 1
				if Rocks == 30 then
					Box("", "", "", "", 0, 0, nil, "", 1)
					for i=1,#Rocas do
						Rocas[i - tableaux].Sprite.Remove()
						table.remove(Rocas, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					Black.alpha = 1
					Audio.PlaySound("Impact6")
				elseif Rocks == 120 then
					timer = 2000
					NewAudio.Stop("Terremoto")
					NewAudio.DestroyChannel("Terremoto")
				end
				for i=1,#Rocas do
					local Datos = Rocas[i]
					Datos.Y = Datos.Y - 8
					Datos.X = Datos.X - 4
					Datos.Sprite.MoveTo(Datos.X, Datos.Y)
					Datos.Rotation = Datos.Rotation + Datos.Vel
					Datos.Sprite.rotation = Datos.Rotation
				end
			end
			if Shake then
				Corredor.MoveTo(Shake[1] + math.random(-2, 2), Shake[2] + math.random(-2, 2))
			end
		elseif timer >= 4000 and timer < 5000 then
			if timer == 4000 and Encounter["Triggered"] then
				Bark = true
				Encounter["Triggered"] = nil
				Frisk.SetVar("PosY", Frisk.y)
				Audio.PlaySound("bark")
				timer = 4001
			elseif timer > 4000 and timer <= 4020 then
				timer = timer + 1
			elseif timer == 4021 then
				Box("", "", "", "", 0, 0, nil, "", 1)
				Dog = CreateSprite("Overworld/Characters/Dog/Walk 1", "Top")
				Dog.SetAnimation({"Overworld/Characters/Dog/Walk 1","Overworld/Characters/Dog/Walk 2"}, 0.08)
				Dog.SetParent(Corredor)
				Dog.SetPivot(0.5, 0)
				Dog.MoveTo(0, Frisk.GetVar("PosY"))
				for i=1,#Pilares do
					Pilares[i].SendToTop()
				end
				timer = 4023
			elseif timer == 4023 then
				if Dog.x >= 180 then
					timer = 4024
					Audio.PlaySound("hurtsound")
					Frisk.SetPivot(0.5, 0.5)
					Frisk.MoveTo(221, Frisk.GetVar("PosY") + 29)
				end
			elseif timer > 4023 and timer <= 4113 then
				timer = timer + 1
				Frisk.MoveTo(221, Frisk.GetVar("PosY") + 29 - 15/90*(timer - 4024) + 100*math.sin(math.rad(180/90*(timer - 4024))))
				Frisk.rotation = 990/90*(timer - 4024)
				if timer == 4114 then
					Audio.PlaySound("hurtsound")
				end
			elseif timer > 4113 and timer <= 4143 then
				timer = timer + 1
				Frisk.MoveTo(221, Frisk.GetVar("PosY") + 14 + 10*math.sin(math.rad(180/30*(timer - 4114))))
				Frisk.rotation = 270 + 10*math.sin(math.rad(180/30*(timer - 4114)))
			elseif timer > 4143 and timer <= 4163 then
				timer = timer + 1
				Frisk.MoveTo(221, Frisk.GetVar("PosY") + 14 + 6*math.sin(math.rad(180/20*(timer - 4144))))
			elseif timer > 4163 and timer <= 4173 then
				timer = timer + 1
				Frisk.MoveTo(221, Frisk.GetVar("PosY") + 14 + 2*math.sin(math.rad(180/10*(timer - 4164))))
			elseif timer == 4174 then
				timer = 4175
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[voice:papyrus][SetAnimation:Scared 2]E-[StopAnimation][SetCara:Scared 1][w:10][SetAnimation:Scared 2]Estás bien\rhumano?[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				else
					Box("[voice:papyrus][SetAnimation:Scared 2]A-[StopAnimation][SetCara:Scared 1][w:10][SetAnimation:Scared 2]Are you okay\rhuman?[StopAnimation][SetCara:Scared 1]", "papyrus", "Scared 1", "", 0, 400, nil, "", 1)
				end
			elseif timer == 4175 and Boxes[1] and not Boxes[1].Activo then
				timer = 4176
			elseif timer > 4175 and timer <= 4185 then
				timer = timer + 1
				Frisk.MoveTo(221 + 2*math.sin(math.rad(360/10*(timer - 4176))), Frisk.GetVar("PosY") + 14)
			elseif timer > 4185 and timer <= 4245 then
				timer = timer + 1
			elseif timer == 4246 then
				timer = 4247
				Audio.PlaySound("st")
				Frisk.SetPivot(0.5, 0)
				Frisk.rotation = 0
				Frisk.MoveTo(221, Frisk.GetVar("PosY"))
			elseif timer > 4246 and timer <= 4306 then
				timer = timer + 1
			elseif timer == 4307 then
				timer = 4308
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[voice:papyrus][SetAnimation:Worried 2]Gracias a dios\rque estás bien.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				else
					Box("[voice:papyrus][SetAnimation:Worried 2]Thank god you're\rokay.[StopAnimation][SetCara:Worried 1]", "papyrus", "Worried 1", "", 0, 400, nil, "", 1)
				end
			elseif timer == 4308 and Boxes[1] and not Boxes[1].Activo then
				timer = 4309
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Box("[voice:papyrus][SetAnimation:Thinking 2]Pretendamos que no\rpasó nada.[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				else
					Box("[voice:papyrus][SetAnimation:Thinking 2]Let's just pretend\rnothing happened.[StopAnimation][SetCara:Thinking 1]", "papyrus", "Thinking 1", "", 0, 400, nil, "", 1)
				end
			elseif timer == 4309 and Boxes[1] and not Boxes[1].Activo then
				Player.hp = math.max(Player.hp - 2, 1)
				timer = 2000
			end
			if timer > 4022 and Dog then
				if Dog.x >= 350 then
					if Frisk.GetVar("PosY") <= -145 and Dog.y < -112 then
						Dog.MoveTo(Dog.x + 5, Dog.y + 3)
					elseif Frisk.GetVar("PosY") > -145 and Dog.y > -178 then
						Dog.MoveTo(Dog.x + 5, Dog.y - 3)
					else
						Dog.MoveTo(Dog.x + 5, Dog.y)
					end
				else
					Dog.MoveTo(Dog.x + 5, Dog.y)
				end
				if Dog.x >= 800 then
					Dog.Remove()
					Dog = nil
				end
			end
		elseif timer >= 5000 then
			timer = timer + 1
			if timer == 5001 then
				TipoFrisk = "N"
				Frisk.alpha = 0
				Heart = CreateSprite("Overworld/Objects/Soul","Top")
				Heart.color = Player.sprite.color
				Heart.MoveTo(Frisk.absx, Frisk.absy + Frisk.height/2)
				for i=1,#Pilares do
					Pilares[i - tableaux].Remove()
					table.remove(Pilares, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				if Bones1 and Bones2 and Bones3 and Bones4 then
					Bones1.Remove()
					Bones2.Remove()
					Bones3.Remove()
					Bones4.Remove()
					Bones1 = nil
					Bones2 = nil
					Bones3 = nil
					Bones4 = nil
				end
				if Note then
					Note.Remove()
					Note = nil
					Encounter["Filled"] = true
				end
				SavePoint.Remove()
				SavePoint = nil
				Box1.Remove()
				Box1 = nil
				EggDog.Remove()
				EggDog = nil
				Black.Remove()
				Black = nil
				PilarOw.Remove()
				PilarOw = nil
				PilarOwN.Remove()
				PilarOwN = nil
				Corredor.alpha = 0
				CorredorN.alpha = 0
				Audio.PlaySound("st")
			elseif timer == 5004 then
				Frisk.alpha = 1
				Heart.alpha = 0
			elseif timer == 5007 then
				Frisk.alpha = 0
				Heart.alpha = 1
				Audio.PlaySound("st")
			elseif timer == 5010 then
				Frisk.alpha = 1
				Heart.alpha = 0
			elseif timer == 5013 then
				Frisk.alpha = 0
				Heart.alpha = 1
				Heart.SetVar("diff", {48 - Heart.absx, 25 - Heart.absy})
				Audio.PlaySound("st")
			elseif timer >= 5033 and timer < 5053 then
				Heart.MoveTo(Heart.absx + Heart.GetVar("diff")[1]/20, Heart.absy + Heart.GetVar("diff")[2]/20)
				if timer == 5033 then
					Audio.PlaySound("start")
					Encounter.Call("PapyrusAlpha", 0)
					Encounter.Call("SpawnEggDog")
				end
			elseif timer == 5053 then
				Heart.alpha = Heart.alpha - 0.05
				if Heart.alpha > 0 then
					timer = 5052
					Encounter.Call("ConfigurateKR", {false, false})
				end
			elseif timer >= 5083 then
				if not reproduced then
					NewAudio.PlaySound("Loop", "Enemy Aproaching", true, 1)
					reproduced = true
				end
				BlackDefinitive.alpha = BlackDefinitive.alpha - 0.1
				if BlackDefinitive.alpha <= 0 then
					Encounter["Important"] = {X = Frisk.x, Y = Frisk.y, Direction = FriskDirection, CX = Corredor.x, CY = Corredor.y}
					Heart.Remove()
					Frisk.Remove()
					Corredor.Remove()
					CorredorN.Remove()
					BlackDefinitive.Remove()
					Encounter["Alternative"] = 1
					Encounter["flee"] = false
					if #Encounter["Items"] <= 0 then
						if GetAlMightyGlobal("Idioma") == "Spanish" then
							Encounter["Items"] = {"[starcolor:7d7d7d][color:7d7d7d]Nada[color:ffffff]"}
						else
							Encounter["Items"] = {"[starcolor:7d7d7d][color:7d7d7d]Nothing[color:ffffff]"}
						end
					end
					Inventory.SetInventory(Encounter["Items"])
					if Pressed then
						Encounter["Special"] = true
					end
					Encounter["enemies"][4].Call("SetActive", true)
					Encounter["enemies"][1].Call("SetActive", false)
					EndWave()
				end
			end
		end
		for i=1,#Pilares do
			Pilares[i].x = Pilares[i].GetVar("Datos") + (Corredor.x - 1400)
		end
		if Input.GetKey("P") == 1 and (timer < 2000 or (timer >= 3000 and timer < 5000)) then
			Pause = 0
		end
	else
		if Pause == 0 then
			if not Text and not Option1 and not Option2 then
				Text = CreateSprite("Menu/Pausa","Top")
				Option1 = CreateSprite("Menu/Continuar","Top")
				Option2 = CreateSprite("Menu/Quitar","Top")
				Text.MoveTo(320, 260)
				Option1.MoveTo(170, 200)
				Option2.MoveTo(470, 200)
			end
			Black.alpha = Black.alpha + 0.02
			Text.alpha = Black.alpha*2
			Option1.alpha = Black.alpha*2
			Option2.alpha = Black.alpha*2
			if Black.alpha >= 0.5 then
				Pause = 1
				Audio.PlaySound("pip")
			end
		elseif Pause == 1 then
			Option1.color = {1,1,0}
			Option2.color = {1,1,1}
			if Input.Right == 1 then
				Pause = 2
				Audio.PlaySound("pip")
			elseif Input.Confirm == 1 then
				Audio.PlaySound("confirm")
				Option1.color = {1,1,1}
				Option2.color = {1,1,1}
				Pause = 3
			end
		elseif Pause == 2 then
			Option1.color = {1,1,1}
			Option2.color = {1,1,0}
			if Input.Left == 1 then
				Pause = 1
				Audio.PlaySound("pip")
			elseif Input.Confirm == 1 then
				Audio.PlaySound("confirm")
				Option1.color = {1,1,1}
				Option2.color = {1,1,1}
				Pause = 4
			end
		elseif Pause == 3 then
			Black.alpha = Black.alpha - 0.02
			Text.alpha = Black.alpha*2
			Option1.alpha = Black.alpha*2
			Option2.alpha = Black.alpha*2
			if Black.alpha <= 0 then
				Text.Remove()
				Option1.Remove()
				Option2.Remove()
				Text = nil
				Option1 = nil
				Option2 = nil
				Pause = nil
			end
		elseif Pause == 4 then
			Black.alpha = Black.alpha + 0.02
			Text.alpha = Text.alpha - 0.04
			Option1.alpha = Text.alpha
			Option2.alpha = Text.alpha
			if Black.alpha >= 1 then
				if not wait2 then
					wait2 = 0
				end
				wait2 = wait2 + 1
				if wait2 == 60 then
					Text.Remove()
					Option1.Remove()
					Option2.Remove()
					Text = nil
					Option1 = nil
					Option2 = nil
					Pause = 5
					EndAll = true
				end
			end
		end
	end
	if EndAll then
		Box("", "", "", "", 0, 0, nil, "", 1)
		for i=1,#Pilares do
			Pilares[i - tableaux].Remove()
			table.remove(Pilares, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		if Bones1 and Bones2 and Bones3 and Bones4 then
			Bones1.Remove()
			Bones2.Remove()
			Bones3.Remove()
			Bones4.Remove()
		end
		if Note then
			Note.Remove()
		end
		if Papyrus then
			Papyrus.Remove()
			Papyrus = nil
		end
		if Paps then
			Paps.Remove()
			Paps = nil
		end
		SavePoint.Remove()
		Box1.Remove()
		EggDog.Remove()
		Black.Remove()
		PilarOw.Remove()
		PilarOwN.Remove()
		Frisk.Remove()
		Corredor.Remove()
		CorredorN.Remove()
		BlackDefinitive.Remove()
		Encounter["nextwaves"] = {"Menu"}
		State("ACTIONSELECT")
		State("DEFENDING")
	end
end